<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>用户登录	</title>
	<script src="../static/js/common.js"></script>
	<link rel="stylesheet" type="text/css" href="../static/css/login.css?v=<%= System.currentTimeMillis()%>" />
</head>
<body>
	<div class="login-box">
	    <div class="left-img"></div>
	    <div class="form-box">
	        <input type="text" name="code" id="input-code" placeholder="UserName">
	        <input type="password" name="password" id="input-pwd" placeholder="password">
	        <a id="a-forget-pwd" href="./findPassword">forget your password?</a>
	        <a id="a-register"  href="./register">sign up</a>
	        <button id="btn-login" onclick="login()">login</button>
	     </div>
	 </div>
</body>

<script type="text/javascript">
// 公用js
function intent(url, param){
	var newUrl = base_url + url;
	if(param != null && param !='') newUrl += '?' + param;
	console.log(newUrl);
	location.href = newUrl;
}
</script>

<script type="text/javascript">
// 提交登录
function submitLogin(code, pwd){
	intent('user/login', 'code=' + code + '&pwd=' + pwd);
}

function login(){
	var userName = document.getElementById('input-code').value;
	var userPassword = document.getElementById('input-pwd').value;
	
	// 检查登录信息
	if (userName=='' || userPassword=='') {
		alert('请正确输入登录信息！');
		return;
	}
	submitLogin(userName, userPassword);
}
</script>

</html>